package com.galeno.blink.demo;


import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.util.HashSet;
import java.util.Set;

/**
 * @author galeno
 * @Title:
 * @Description:
 * @date 2021/10/1820:40
 */
public class AliBabaBlink {
    public static void main(String[] args) throws Exception {
        Configuration conf = new Configuration();
        conf.setInteger("rest.port",8081);
        StreamExecutionEnvironment env = StreamExecutionEnvironment.createLocalEnvironmentWithWebUI(conf);
        DataStreamSource<String> line1 = env.socketTextStream("192.168.77.101", 8888);
        SingleOutputStreamOperator<String> line3 = line1.map(x -> {
            return x;
        }).setParallelism(3);
        DataStreamSource<String> line2 = env.socketTextStream("192.168.77.101", 9999);
        SingleOutputStreamOperator<String> lines4 = line2.map(x -> {
            return x;
        }).setParallelism(5);
        DataStream<String> union = line3.union(lines4);
        union.print();
        env.execute();


    }
}
